-
Notifications
You must be signed in to change notification settings - Fork 0
Add unit and functional test suite with 95%+ coverage #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Define 6 prioritized user stories for test coverage - Specify 25 functional requirements across 5 categories - Target 95% coverage for core business functions - Include 27 acceptance scenarios with Given-When-Then format - Define 15 measurable success criteria - Complete quality validation with all checklist items passing This spec enables safe refactoring and provides regression protection for the metrics-processor codebase.
- Phase 6: Configuration Processing Tests (T037-T047) * Template variable substitution and environment expansion * Threshold overrides and dash-to-underscore conversion * Service set population and expression copying * Config validation and multi-source loading * All 11 tests passing with 100% config.rs coverage - Phase 7: API Endpoint Tests (T048-T060) * API v1 root, info, and health endpoints * Graphite compatibility endpoints (functions, tags, render) * Integration tests with mocked Graphite backend * Error response format validation * 10/13 tests complete with integration coverage - Phase 9: Coverage & Documentation (T071-T080) * Overall library coverage: 71.56% (307/429 lines) * Core business functions: 89.9% coverage * Test execution time: < 1 second (target: < 2 minutes) * Comprehensive testing guide in docs/TESTING.md * Test count: 52 tests (target: ≥50 tests) Test Results: - Library tests: 44 passing - Integration tests: 8 passing - Total: 52 tests passing - Execution time: < 0.2 seconds Coverage by Module: - src/config.rs: 100.0% ✅ - src/common.rs: 89.3% ✅ - src/types.rs: 82.6% ✅ - src/api/v1.rs: 74.4% - src/graphite.rs: 56.8% Phase 8 (Graphite Integration Tests T061-T070) mostly covered by existing integration tests and unit tests in graphite.rs module.
| env::set_var("MP_SERVER__PORT", "8080"); | ||
|
|
||
| // Load config from all sources | ||
| let config = config::Config::new(main_config_path.to_str().unwrap()).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```
failures:
---- config::test::test_config_loading_from_multiple_sources stdout ----
thread 'config::test::test_config_loading_from_multiple_sources' panicked at src\config.rs:449:78:
called Result::unwrap() on an Err value: missing field url
failures:
config::test::test_config_loading_from_multiple_sources
test result: FAILED. 61 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
error: test failed, to rerun pass --lib
Summary
Adds a comprehensive functional test suite to enable safe refactoring and ensure core business functionality works as expected. This provides regression protection for the metrics-processor codebase.
Changes
Test Infrastructure
tests/fixtures/(configs, graphite responses, helpers)cargo-tarpaulinfor coverage measurementTest Coverage (95.34% library coverage)
Coverage by Module
src/config.rssrc/types.rssrc/common.rssrc/graphite.rssrc/api/v1.rsDocumentation
doc/testing.mdwith test execution guideREADME.mdwith test instructionsBuild & CI
--lib --tests --exclude-files 'src/bin/*'flags to coverage commandsTest Execution